import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { APIBase } from 'app/modules/base/api-base';

@Injectable({
  providedIn: 'root'
})
export class CertificationService extends APIBase<FormData, Assets> {

  constructor(protected http: HttpClient) {
    super(http, '/api/admin/asset');
  }

  get<T>() {
    return this.http.get<T>('/api/admin/asset').toPromise();
  }

  patchFile(payload: FormData) {
    return this.http.patch('/api/admin/asset', payload).toPromise();
  }

  deleteFile() {
    return this.http.delete('/api/admin/asset').toPromise();
  }
  //获取资产设备默认清单模版地址
  getDownTemp(){
    return this.http.get('/api/admin/config?key=DefaultAssetPath').toPromise();
  }
  //删除终端可登陆人员
  delUser(param){
      return this.http.request<void>('DELETE', `/api/admin/pc/${param.pc_id}/user`, { body: param.list }).toPromise();
  }
}

export interface Assets {
  created_at: string;
  remark: string;
  sys_group: string;
  sys_key: string;
  sys_value: string;
}
